<?php
/**
 *
 *
 */

require_once('Zend/Sql/Adapter/Standard/Expression/Abstract.php');

/**
 *
 */
class Zend_Sql_Adapter_Standard_Expression_List
	extends Zend_Sql_Adapter_Standard_Expression_Abstract
	implements Iterator, arrayaccess
{
	/**
	 * @var int
	 */
	protected $position = 0;
	/**
	 * @var array of Zend_Sql_Abstract
	 */
	protected $array = array();

	public function __construct() {
		$this->position = 0;
	}

	function rewind() {
		$this->position = 0;
	}

	function current() {
		return $this->array[$this->position];
	}

	function key() {
		return $this->position;
	}

	function next() {
		++$this->position;
	}

	function valid() {
		return isset($this->array[$this->position]);
	}
	
	// implements ArrayAcces
	public function offsetSet($offset, $value) {
		if (is_null($offset)) {
			$this->array[] = $value;
		} else {
			$this->array[$offset] = $value;
		}
	}
	public function offsetExists($offset) {
		return isset($this->array[$offset]);
	}
	public function offsetUnset($offset) {
		unset($this->array[$offset]);
	}
	public function offsetGet($offset) {
		return isset($this->array[$offset]) ? $this->array[$offset] : null;
	}
	
	// Implements Zend_Sql_Abstract
	function toString() {
		// @TODO
		return implode(', ', $this->array);
	}
	function toArray() {
		// @TODO
		return $this->array;
	}
}
